//
//  GoodsDetailCountDownCell.m
//  YunGou
//
//  Created by macbook on 16/5/24.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "GoodsDetailCountDownCell.h"
#import "MZTimerLabel.h"
@interface GoodsDetailCountDownCell ()<MZTimerLabelDelegate>
@property (weak, nonatomic) IBOutlet MZTimerLabel *countDownLabel;
@end

@implementation GoodsDetailCountDownCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setModel:(ProductModel *)model{
    MZTimerLabel *timeLabel = [[MZTimerLabel alloc] initWithLabel:_countDownLabel andTimerType:MZTimerLabelTypeTimer];
    timeLabel.delegate = self;
    [timeLabel setCountDownTime:model.q_end_time - NowTime];
    timeLabel.timeFormat = @"mm:ss SS";
    [timeLabel start];
}

-(void)timerLabel:(MZTimerLabel*)timerLabel finshedCountDownTimerWithTime:(NSTimeInterval)countTime{
    if (self.endCountDownBlock) {
        self.endCountDownBlock();
    }
}

- (IBAction)calculateClicked:(id)sender {
    if (self.countdownBlock) {
        self.countdownBlock();
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
